<%@ page language="java" contentType="text/html; charset=windows-1255"
	pageEncoding="windows-1255"%>
<%@page import="logic.Reports"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="com.sun.org.apache.xalan.internal.xsltc.compiler.sym"%>
<html>
<head>
<title>secret 4 plus dog</title>
<meta http-equiv="Content-Type"
	content="text/html; charset=windows-1255">
<link href="secret4.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#FF6600" dir="ltr">
<a href="login.jsp">Logout</a>    <a href="userPanel.jsp">Main panel</a>
<%
	String param1 = request.getParameter("p");
	String type = request.getParameter("type");
	String param2 = request.getParameter("b");
	if ((String) session.getAttribute("currentUser") == null) {
		response.sendRedirect("login.jsp");
	}else if (((String) session.getAttribute("type")).equals("user")) {
		response.sendRedirect("userPanel.jsp?Bad");
	}
%>
<table height="100%" width="100%" border="0" cellspacing="3"
	cellpadding="2">
	<tr>
		<td width="10%">&nbsp;</td>
		<td valign="top">
		<table height="100%" width="100%" border="0" cellspacing="3"
			cellpadding="2">
			<tr height="20%">
				<td>&nbsp;</td>
			</tr>
			<tr height="80%">
				<td>
				<table align="left" width="100%" border="0" cellspacing="3"
					cellpadding="2">
					<tr>
						<td width="65%" align="left" valign="top">
						<table width="100%" border="0" cellspacing="3" cellpadding="2">
							<tr>
								<td class="title">
<%
if (type!=null && type.equals("pie")){
	out.println("Rating distribustion for the " + (param2!=null && param2.equals("true") ? "top " : "bottom ") + "" + param1 + " movies");
} else if (type.equals("bar")){
	out.println("Rating chart " + param1);
}
%>
</td>
							</tr>
							<tr>
								<td>
								<table width="100%" border="0" cellspacing="3" cellpadding="2">

									<tr>
										<td>

<%
	if (type!=null && type.equals("pie")){
		out.println("<img src=\""+ Reports.getMoviesChart(Integer.parseInt(param1), Boolean.parseBoolean(param2)) +"\" width=\"100%\">");
		out.println("<br>* the number  after the movie name is the number of raters who rated the movie");
	} else if (type.equals("bar")){
		out.println("<img src=\""+ Reports.getMovieRatingChart(param1) +"\" width=\"100%\">");
	}

%>
										</td>
									</tr>

								</table>
								</td>
							</tr>
						</table>
						</td>
						<td valign="top"><img src="Secret4PlusDog.jpg" width="220"
							height="407"></td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		</td>
		<td width="10%">&nbsp;</td>
	</tr>
</table>

</body>
</html>
